 <div class="modal-dialog">
   				 <div class="form-group" style="display:none" id="cloneOption">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1">选项一</label>
								<div class="col-sm-8">
									<input type="text" name="options" id="form-field-1" class="col-xs-7 col-sm-7" value="${(op.name)!}"
									data-rule-required="true" data-msg-required="名称必填"><button style="margin-left:10px;" class="btn btn-xs btn-danger" name="optionRemoveBtn"><i class="icon-remove" ></i></button>
								</div>
			  </div>
		       <form class="form-horizontal" role="form" id="optionsForm">
		      <div class="modal-content">
		         <div class="modal-header">
		            <button type="button" class="close" 
		               data-dismiss="modal" aria-hidden="true">
		                  &times;
		            </button>
		            <h4 class="modal-title" id="myModalLabel">
		               	维护选项
		            </h4>
		          
		         </div>
		         <div class="modal-body" id="permissionDialog">
		        	 <button type="button" class="btn btn-primary btn-xs" name="addOptionsBtn" style="float:right;margin-right:10px;" ><i class="icon-plus"></i>添加选项</button>
		        	 
		        	 <input type="hidden" name="questionid" value="${id!''}"/>
		        	 <div style="clear:both;"></div>
		        	 <div id="optionListDiv"> 
		        	 <#if options??>
						 <#list options as op>
						 <div class="form-group" name="option">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1">选项一</label>
								<div class="col-sm-8">
									<input type="text" name="options" id="form-field-1" class="col-xs-7 col-sm-7" value="${(op.name)!}"
									data-rule-required="true" data-msg-required="名称必填"><button style="margin-left:10px;" class="btn btn-xs btn-danger" name="optionRemoveBtn"><i class="icon-remove" ></i></button>
								</div>
						</div>
						</#list>
					</#if>
					</div>
		         </div>
		         <div class="modal-footer">
		            <button type="button" class="btn btn-warning" 
		               data-dismiss="modal">关闭
		            </button>
		            <button type="button" class="btn btn-primary" id="saveQuestionBtn">
		               	保存
		            </button>
		         </div>
	 </div><!-- /.modal-content -->
	 </form>
	</div>
<script>
	$("#saveQuestionBtn").click(function(){
		$.post("/admin/activity/vote/saveOptions",$("#optionsForm").serialize(),function(result){
			if(result.code==200){
				$("#maintainOption_dialog").modal("hide");
			}else{
				layer.msg(data.msg);
			}
		});
	});
	$(".modal-dialog").on("click","[name='optionRemoveBtn']",function(){
		$(this).parent().parent().remove();
	}).on("click","[name='addOptionsBtn']",function(){
		var html =$("#cloneOption").clone().show().attr("name","option");
		if(!$("div[name='option']").html()){
			$("#optionListDiv").html(html);
		}else{
			$("div[name='option']:last").after(html);
		}
	});
</script>
